#include "progress.h"
#include <string.h>
#include <unistd.h>
#define STYLE '='
void process_v1(){
    char buffer[101];
    memset(buffer,0,sizeof(buffer));
    const char *lable="|/-\\";
    int len = strlen(lable);
    int cnt = 0;
    while(cnt <= 100){
        printf("[%-100s][%d%%][%c]\r",buffer,cnt,lable[cnt%len]);
        fflush(stdout);
        buffer[cnt++]=STYLE;
        usleep(50000);
    }
    printf("\n");
}
void FlushProcess(double total, double current){
    char buffer[101];
    memset(buffer, 0, sizeof(buffer));
    const char *lable="|/-\\";
    int len = strlen(lable);
    static int cnt=0; 
    int num=(current/total*100);
    for(int i=0;i<num;i++){
        buffer[i]=STYLE;
    }
   double rate=current/total*100;
   cnt%=len;
   printf("[%-100s][%.1f%%][%c]\r", buffer, rate, lable[cnt]);
   cnt++;
   fflush(stdout);

   
    
    
}
